home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / comm / cnet / Cnetcal.lha / calendar / calendar.rexx < prev   
OS/2 REXX Batch file  |  1994-07-20  |  6KB  |  58 lines

  1. /*****************************************************************************
  2.  *           CNet Events Calendar 2.2 (c) Stan Smith-  14 July 1994          *
  3.  *                                                                           *
  4.  * Either add as a standard AREXX Pfile/GFile (no arguments needed) or       *
  5.  * install in sys.welcome as {#0 pfiles:calendar/calendar}                   *
  6.  *                           |                                               *
  7.  *                           `- {=control-Q                                  *
  8.  *   You may change the path if you wish to move the calendar data file.     *
  9.  *     The format of the data file should be self-explanatory...             *
  10.  *   The two comment lines below may be changed to whatever you wish; you    *
  11.  *     have 41 characters to play with.  This text is auto-centered, so      *
  12.  *     don't worry about formatting it.                                      *
  13.  *                                                                           *
  14.  *      I can be reached at:  Surface Normal BBS   (209)725-2623,,,22222222  *
  15.  *                            Fido   1:208/602.0                             *
  16.  *****************************************************************************/
  17. path="pfiles:calendar/"                        /* Path of Special Events file*/
  18.                                                /* You have this much room on */
  19. /*   |----------------41 chars-----------------| 2 lines for comments...     */
  20. fr.6="If you know of an upcoming special"
  21. fr.7="event, please inform Ignus Fast!"
  22.  
  23. options results;arg a;a=left(a,2);signal on SYNTAX;signal on ERROR;signal on IOERR;sx=sendstring;tx=transmit;getuser 28;gr=result
  24. bbsidentify sysop;sname=result;bbsidentify name;bbs=result;y=left(date(s),4);mn="January February March April May June July August September October November December"
  25. fn="cal.";mx=19;pc="###PANIC";tx "   c3Welcome to cbCNet Events Calendarc3 2.2!n1";p=right(path,1);if ~(p="/"|p=":") then path=path"/"
  26. if a="EV" then signal EVENT;if a="BD" then fn="cal.bdays.";if a="NO"|a="BD"|a="BO" then signal CONT
  27. if exists(path||fn"bdays."y) then do;sx "cbDo you wish to look at upcoming "bbs" user birthdays?n1c3(Otherwise, you'll see normal events/holidays) ca[y/N/q] c3"
  28. getchar;j=result;tx j;if j=pc | j="Q" then exit;if j="Y" then fn="cal.bdays.";end
  29. CONT:ee="Events";if right(fn,6)="bdays." then ee="User Birthdays";sx "Please wait one moment- setting up "ee" Calendar..."
  30. o="";bk="";rd="";gn="";yl="";bl="";mg="";cy ="";wt="";bw="";ct="";vl="³";hl="Ä"
  31. fr.1="ÚÄÄÄÄÂÄÄÄÄÂÄÄÄÄÂÄÄÄÄÂÄÄÄÄÂÄÄÄÄÂÄÄÄÄ¿";fr.2="ÃÄÄÄÄÅÄÄÄÄÅÄÄÄÄÅÄÄÄÄÅÄÄÄÄÅÄÄÄÄÅÄÄÄÄ´";fr.8=copies(hl,41)
  32. fr.3="ÀÄÄÄÄÁÄÄÄÄÁÄÄÄÄÁÄÄÄÄÁÄÄÄÄÁÄÄÄÄÁÄÄÄÄÙ";fr.4="³ SU ³ MO ³ TU ³ WE ³ TH ³ FR ³ SA ³";fr.5=center(" "bbs" BBS ",41,hl)
  33. if gr~=2 then do;o="";bk=o;rd=o;gn=o;yl=o;bl=o;mg=o;cy=o;wt=o;bw=o;ct=o;vl="|";hl="-";do i=1 to 7;fr.i=translate(fr.i,"+-++...`""'|","ÃÄÅ´Ú¿ÀÁÙ³");end;end
  34. do i=1 to 4;fr.i=bw||fr.i||o;end;l.3=fr.4
  35. nd="31 28 31 30 31 30 31 31 30 31 30 31";dn="Sunday Monday Tuesday Wednesday Thursday Friday Saturday"
  36. mn="January February March April May June July August September October November December";ny=y;ty=y;m=substr(date('s'),5,2);td=substr(date('s'),7,2)
  37. fd=date(w,y||m||01,'s');f=find(dn,fd)-1;if (y-1992)//4=0 then nd=overlay("29",nd,4);c=2;s=4;om=0;do i=0 to mx;e.i="";end
  38. LOOP:if ~open(file,path||fn||ny,r) then do;tx;sx ny" Events file missing!";signal DOIT;end;do i=1 to 31;flag.i=0;end
  39.   do until eof(file);l=readln(file);pp=left(l,2);if ~datatype(pp,n) then iterate;if pp=m & ny=y then do;t=substr(l,3,2)+0;flag.t=1;end
  40.     if pp>m & s=4 then do;s=5;e.3="        Nothing scheduled...";c=c+2;end;if pp=m | s>4 & s<mx+4 then do
  41.     if pp~=om then do;sx "." ;om=pp;e.c="        "yl||center(" "word(mn,pp)ty" ",33,hl);ty="";c=c+1;s=s+1;end
  42.     if ~(pp=m & t<td) then do;e.c=substr(l,5,41);s=s+1;c=c+1;end;end;end;call close(file);if s<mx then do;ny=ny+1;ty=" "ny;signal LOOP;end
  43. DOIT:l.1=center("- "word(mn,m) y" -",36)o;l.2=center(" ",36);l.4=fr.2
  44.   d=1;ln=5;do while d<=word(nd,m);sx ".";l.ln=bw;do c=0 to 6;if d<=word(nd,m) & c>=f then do;cl=bl;cl2="";c1=" "
  45.         if flag.d=1 then do;cl=rd;c1="-";end;if d=td then do;cl=ct;cl2=o||bw;c1="*";end
  46.         l.ln=l.ln||bk||vl||cl||c1||right(" "d,2)c1||cl2;d=d+1;f=0;end;else l.ln=l.ln||bk||vl"    ";end
  47.     l.ln=l.ln||bk||vl||o;ln=ln+1;l.ln=fr.2;ln=ln+1;end
  48.   tx "f1"gn||center("Calendar of "ee": ",36) yl||fr.5"n1"l.1 rd||center(fr.6,41)"n1"l.2 rd||center(fr.7,41)"n1"fr.1 yl||copies(hl,8)center(" "word(mn,m)" ",33,hl)
  49.   do c=16 to mx;l.c=left(" ",36);end;if ln>15 then l.16=fr.3;else do;l.14=fr.3;l.15=l.mx;end;do c=3 to mx;tx l.c rd||left(e.c,5)gn||substr(e.c,6)o;end
  50.   tx "cePress [enter]g1";if a="BO" then do;fn="cal.bdays.";a="";signal CONT;end;exit
  51. EVENT:getuser 2400096;la=result;do i=1 to la;loadscratch i;j=result;savescratch i-2*i;if ~j then iterate
  52.   getuser 1101230;if result then iterate;getuser 1300744;nm=result;getuser 1501082;bd=result;do j=1 to 12;if left(word(mn,j),3)=substr(bd,8,3) then m=j;end
  53.   d=substr(bd,5,2)+0;ex="th";es="1 st 2 nd 3 rd 10 th 11 th 12 th 13 th";do l=1 to words(es) by 2;j=word(es,l);if right(d,length(j))=j then ex=word(es,l+1);end
  54.   if ~open(file,"ram:cal.bdays",'a') then call open(file,"ram:cal.bdays",'w')
  55.   call writeln(file,right(m,2,"0")right(d,2,"0")" "left(d||ex,5)left("- "nm"'s birthday!",36));call close(file);end
  56.   address command "sort ram:cal.bdays "path"cal.bdays."y;address command "sort ram:cal.bdays "path"cal.bdays."y+1;address command "delete ram:cal.bdays";exit
  57. SYNTAX:IOERR:ERROR:tx errortext(RC)" error in l "sigl"n1>>"sourceline(sigl)"<<n1Please notify "sname"g1";exit 10
  58.